<!DOCTYPE html>
<html lang="zh-cmn-Hans">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
		<title>收货地址</title>
		<link rel="stylesheet" href="../../css/ui.min.css" />
		<link rel="stylesheet" href="../../css/iconfont.css" />
		<link rel="stylesheet" href="../../css/shop.css" />
	</head>
	<body ontouchstart>
		<div id="app">
			<header class="ui-header">
				<a href="javascript:history.go(-1)" class="ui-icon hd-left">
					<span class="iconfont icon-fanhui"></span>
				</a>
				<div class="ui-title">收货地址</div>
				<a href="xinzeng-add.html" class="icon-text hd-right">添加新地址</a>
			</header>
			<div class="ui-content">
				<div class="adds-cells">
					<div class="ui-cell ui-adds-cell" v-for="item in User_address" @click="editaddr(item);">
						<div class="adds-icon">
							<img src="../../images/adsicon.png" alt="">
						</div>
						<div class="ui-cell__bd">
							<div class="ads-header">
								<span class="a-name">{{item.consignee}}</span><span class="a-tel">{{item.mobile}}</span>
							</div>
							<div class="ads-cont">
								<span class="tag">默认</span>{{item.province_name}}{{item.city_name}}{{item.district_name}}{{item.address}}
							</div>
						</div>
						<a href="javascript:void(0);" class="ads-edit">编辑</a>
					</div>
				</div>
			</div>
		</div>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/vue.min.js"></script>
		<script src="../../js/common/config.js"></script>
		<script>
			// mui插件初始化
			mui.init();
			mui.plusReady(function() {
				vm.init();
			})
			
			var vm = new Vue({
				el: "#app",
				data: {
					User_address:{},
				},
				methods: {
					init(){
						this.user_id = localStorage.getItem('user_id');
						this.getData();
					},
					getData(){
						var _that = this;
						console.log(this.user_id);
						mui.ajax(Config.api.User_address_show, {
							data: {
								request_type: 1,
								user_id:this.user_id,
							},
							type: 'post',
							dataType: 'json',
							success: function(data) {
								if(data.success == 1){
									console.log(JSON.stringify(data));
									_that.User_address = data.data;
								}
							},
							error: function(xhr, type, errorThrown) {
								console.log("接口错误");
							},
						});
					},
					editaddr(o){
						var url = './bianji-add.html';
						mui.openWindow({
							url: url,
							id: url,
							styles: {
								top: '0px', //新页面顶部位置
								bottom: '0px', //新页面底部位置
							},
							extras: {
								addr:o
							},
						})
					}
				}
			});
		</script>
	</body>
</html>
